
import { App, Entry } from '../types/app';

export const processData = (entries: Entry[]): App[] => {
  if (!entries || !Array.isArray(entries)) return [];
  
  return entries.map((entry: Entry) => ({
    id: entry?.trackId || '',
    name: entry?.trackName || 'Unknown App',
    category: entry?.genres || 'General',
    artworkUrl100: entry?.artworkUrl100 || '',
    averageUserRating: parseFloat(entry?.averageUserRating || '0'),
    userRatingCount: parseInt(entry?.userRatingCount || '0', 10),
    description: entry?.description || '',
    artistName: entry?.artistName || 'Unknown Developer'
  }));
};